package cn.iocoder.yudao.module.digital.enums.cardkeyqueue;

import lombok.AllArgsConstructor;
import lombok.Getter;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

@Getter
@AllArgsConstructor
public enum CardkeyInQueueStatusEnum {
    INIT("INIT", "初始化"),
    IN_PROGRESS("IN_PROGRESS", "处理中"),
    SUCCESS("SUCCESS", "成功"),
    WILL_FAIL("WILL_FAIL", "将要失败"),
    FINAL_FAILURE("FINAL_FAILURE", "最终失败"),
    TIMEOUT("TIMEOUT", "超时");

    /**
     * 状态
     */
    private final String value;

    /**
     * 状态名
     */
    private final String desc;

    // Jackson deserialization method
    @JsonCreator
    public static CardkeyInQueueStatusEnum fromValue(String value) {
        for (CardkeyInQueueStatusEnum status : CardkeyInQueueStatusEnum.values()) {
            if (status.value.equalsIgnoreCase(value)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Invalid value: " + value);
    }

    // Jackson serialization method
    @JsonValue
    public String getValue() {
        return value;
    }

}
